import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { viteMockServe } from 'vite-plugin-mock'
// const { modifyVars } = require('./src/styles/lessModifyVars')

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
    }
  },
  base: './',
  optimizeDeps: {
    exclude: ['vuex']
  },
  css: {
    preprocessorOptions: {
      // less: `@import "${resolve('./src/style/basic.less')}";`
      less: {
        javascriptEnabled: true
      }
    }
  },
  server: {
    port: 3000,
    open: true,
    cors: false,
    https: false,
    proxy: {
      '/JiaDingAPI': {
        target: 'http://10.237.120.74:8080/',
        // target: 'http://10.237.113.176:8093',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/JiaDingAPI/, ""),
      },
    }
  },
  plugins: [
    vue(),
    viteMockServe({
      supportTs: true,
      mockPath: 'mock'
    })
  ],
})
